// pages/equipInfo/equipInfo.js
const app = getApp()
const lbbService = require('../service/service.js')

Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let that = this
    that.setData({
      equipCode: options.equipCode.replace(/[^0-9]/ig,""),
      problemType: options.problemType,
      scrollHeight: app.getScrollHeight(0)
    })
    that.getEquipInfo()
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },
  toEquipUsing: function(){
    let that = this
    wx.navigateTo({
      url: '../equUsingSitua/equUsingSitua?equipCode=' + that.data.equipCode,
    })
  },
  getEquipInfo:function(){
    let that = this
    lbbService.getEquipDetailInfo({ equId: parseInt(that.data.equipCode) },function(res){
      that.setData({
        detailInfo: res.data
      })
    })
  }
})